package com.mdd.admin.vo.order;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Date;

@Data
@ApiModel("租赁订单详情详情Vo")
public class OrderLeaseDetailsDetailVo implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "编号")
    private Long id;


    @ApiModelProperty(value = "订单id")
    private Long orderId;

    @ApiModelProperty(value = "用户id")
    private Long userId;

    @ApiModelProperty(value = "车辆id")
    private Long vehicleId;


    @ApiModelProperty(value = "服务类型")
    private Integer serviceType;

    @ApiModelProperty(value = "租赁类型 1、月 2、周 3、日")
    private Integer leaseType;

    @ApiModelProperty(value = "租赁周期")
    private Integer leasePeriod;
    @ApiModelProperty(value = "当前租期")
    private Integer currentPeriod;

    @ApiModelProperty(value = "首付")
    private BigDecimal downPayments;

    @ApiModelProperty(value = "押金")
    private BigDecimal deposit;

    @ApiModelProperty(value = "每期租金")
    private BigDecimal eachIssue;


    @ApiModelProperty(value = "其他费用")
    private BigDecimal otherExpenses;

    @ApiModelProperty(value = "到期日期")
    private Date dueDate;

    @ApiModelProperty(value = "完成时间")
    private Date completionTime;

    @ApiModelProperty(value = "租户号")
    private String tenantId;

    @ApiModelProperty(value = "乐观锁")
    private Long revision;

    @ApiModelProperty(value = "创建人")
    private String createBy;

    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    @ApiModelProperty(value = "更新人")
    private String updateBy;

    @ApiModelProperty(value = "更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;

    @ApiModelProperty(value = "每期租金Str")
    private String eachIssueStr;
    public String getEachIssueStr() {
        eachIssueStr =  eachIssue.setScale(2, RoundingMode.HALF_DOWN).toString(); // 设置保留两位小数并舍入
        if(leaseType.equals(1)){
            eachIssueStr = eachIssueStr + "/月";
        }else  if(leaseType.equals(2)){
            eachIssueStr = eachIssueStr + "/周";
        }else  if(leaseType.equals(3)){
            eachIssueStr = eachIssueStr + "/日";
        }
        return eachIssueStr;
    }
}
